/**
 * 登陆注册功能API
 */

import axios from 'axios'

const baseUrl = '/giraffe/login'

/* 注册接口
 * data: {mail: 'string', password: 'string', type: number}
 */
export const register = (data) => axios.post(`${baseUrl}/register`, {data})
.then(
  (res) => {
    return res
  }
)

/* 登陆接口
 * data: {mail: 'string', password: 'string', type: number}
 */
export const onLogin = (data) => axios.post(`${baseUrl}/onLogin`, {data})
.then(
  (res) => {
    return res
  }
)

/* 获取用户信息
 * data: {uid: 'string', token: 'string'}
 */
export const getUserInfo = (data) => axios.post(
  `${baseUrl}/getUserInfo`,
  data,
  {headers: {'Content-Type': 'application/json'}})
.then(
  (res) => {
    return res
  }
)
